package com.demo.my.shop.web.admin.dao.impl;

import com.demo.my.shop.domain.User;
import com.demo.my.shop.web.admin.dao.UserDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

@Repository(value = "userDao")
public class UserDaoImpl implements UserDao {
    private static final Logger logger = LoggerFactory.getLogger(UserDaoImpl.class);

    @Override
    public User getUserByEmail(String email) {
        logger.debug("getUser({})",email);

        User user = null;
        if ("admin@java.com".equals(email)) {
            user = new User();
            user.setUserName("admin");
            user.setEmail("admin@java.com");
            logger.info("getUser({}) success",email);
        }
        else {
            logger.warn("getUser({} not found)",email);
        }
        return user;
    }
}
